/*
 * MathFunction.h
 *
 *  Created on: 25 мая 2022 г.
 *      Author: nikitas
 */

#ifndef SRC_MATH_STUFF_MATHFUNCTION_H_
#define SRC_MATH_STUFF_MATHFUNCTION_H_

#include "../STL_includes.h"

#include "../Typedefs.h"
#include "../Enums.h"
#include "MVariable.h"
#include "FArgument.h"

#include "../Static_classes/Counter.h"
#include "../Static_classes/FunctionAnalyzer/FunctionAnalyzer.h"
#include "../Technical/RuntimeErrorClass.h"


namespace STC_calc {

/*
* The MathFunction class is transforming
* a formatted string after the
* SemanticAnalyzer class and
* solving the equation
*/
class MathFunction
{
private:
	std::string func_name;

	std::vector<std::shared_ptr<FArgument>> args;

	std::pair<std::string, string_vector> initialize(const std::string str);
	void check_func(const std::string& name);
	long double calculate();

public:
    MathFunction(const std::string& str);
    MathFunction(const MathFunction& that);
	~MathFunction();
	long double operator()();

    bool operator ==(const MathFunction& that);
    bool operator !=(const MathFunction& that);

	void subsitude_values(const ldouble_vector& values);

};

} /* namespace STC_calc */

#endif /* SRC_MATH_STUFF_MATHFUNCTION_H_ */
